dsh-stream-rules: On-Demand Rule Injection to Reduce Persistent Context

`@jiesou/dsh-stream-rules` is an MIT-licensed DSH plugin (v0.1.7) designed to correct agent tool calls by injecting rules on demand, avoiding the persistent presence of fixed rules in the context to reduce token consumption. The plugin ports the concept from `opencode-stream-rules` to DSH. When a tool call matches a preset rule, it injects system prompts via `agent.inject()` or sets `reject` to deny the initial call, guiding the agent to retry. It leverages DSH's `tools/pre-execute` mechanism, requiring no core modifications or monkey-patching, ensuring compatibility. Users can install it via npm or GitHub, and need to configure it in the configuration file.

Read More